package huanzhao.erp.domain.types;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

/**
 * @author April
 * 2024/10/4 10:31
 * @version 1.0
 */
@Getter
public enum FinanceSettlementType {
    REPAIR_COST("维修成本结算"),
    PURCHASE_RETURN("采购退货结算"),
    SALES_INCOME("销售收入结算"),
    SALES_RETURN("销售退货结算");

    @EnumValue
    @JsonValue
    private final String value;

    FinanceSettlementType(String value) {
        this.value = value;
    }

    public static FinanceSettlementType of(int financeSettlementTypeCode) {
        return switch (financeSettlementTypeCode) {
            case 0 -> REPAIR_COST;
            case 1 -> PURCHASE_RETURN;
            case 2 -> SALES_INCOME;
            default -> SALES_RETURN;
        };
    }
}
